package ControlLayer;

import ModelLayer.*;
import java.util.ArrayList;

/**
 * Write a description of class PersonHandler here.
 * 
 * @author (your name) 
 * @version (a version number or a date)
 */
public class DVDHandler
{
    // instance variables - replace the example below with your own
    private DVDContainer dvdContainer;
    
    /**
     * Constructor for objects of class PersonHandler
     */
    public DVDHandler()
    {
        dvdContainer = DVDContainer.getInstance();
    }

    public boolean addDVD(DVD dvd)
    {
        return dvdContainer.addDVD(dvd);
    }

    public void createDVD(int barcode, String title, String artist, String publicationDate)
    {
        dvdContainer.addDVD(new DVD(barcode,title,artist,publicationDate));
    }

    public DVD findDVD(int barcode)
    {
        return dvdContainer.findDVD(barcode);
    }

    public DVD findDVDByName(String title)
    {
        return dvdContainer.findDVDByName(title);
    }

    public void updateDVD(int barcode, String title, String artist, String publicationDate)
    {
        findDVD(barcode).setTitle(title);
        findDVD(barcode).setArtist(artist);
        findDVD(barcode).setPublicationDate(publicationDate);
    }

    public void deleteDVD(int barcode)
    {
        dvdContainer.deleteDVD(barcode);
    }

    public void deleteDVDByName(String title)
    {
        dvdContainer.deleteDVDByName(title);
    }

    //     public boolean addDVDCopy(String title, String serialNumber, String purchaseDate, String purchasePrice)
    //     {
    //         return dvdContainer.addDVDCopy(title,serialNumber,purchaseDate,purchasePrice);
    //     }

    public void addDVDCopy(String title, String serialNumber, String purchaseDate, String purchasePrice)
    {
        dvdContainer.addDVDCopy(title,serialNumber,purchaseDate,purchasePrice);
    }

    public Copy getCopy(String title)
    {
        return findDVDByName(title).getCopy();
    }  
}
